package com.wc.alorithm_blue_bridge._思维.Q3250;
import java.util.*;
import java.io.*;
/**
 * @Author congege
 * @Description
 * 最大的卡牌价值
 * https://www.lanqiao.cn/problems/3250/learning/?page=1&first_category_id=1
 * @Date Created in 2023/11/23-18:22
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        int k = sc.nextInt();
        long ans = 0;
        int[] a = new int[n];
        int[] b = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
            ans+=a[i];
        }
        for(int i = 0; i < n; i++){
            b[i] = sc.nextInt();
        }
        /**
         * 存储所有增益的数字
         */
        ArrayList<Integer> subs = new ArrayList<>();

        for(int i = 0;i < n; i++){
            if(b[i] > a[i]){
                subs.add(b[i] - a[i]);
            }
        }
        Collections.sort(subs);
        int index = subs.size() - 1;
        for(int i = k;i > 0 && index>=0; i--,index--){
            ans += subs.get(index);
        }
        System.out.println(ans);
    }

    static class Input{
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt(){
            try{
                in.nextToken();
            }catch(Exception e){
                return -1;
            }
            return (int) in.nval;
        }
    }
}
